<!-- <template>
  <form :class="style__">
    <div class="form-group">
      <label class="col-sm-12 control-label">用户姓名</label>
      <div class="col-sm-12">
        <input type="text"  readonly="readonly"  v-model="f_user_name" maxlength="10" class="form-control"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">用户电话</label>
      <div class="col-sm-12">
        <input type="text" v-model="f_user_phone" maxlength="15" class="form-control"/>
        <a href="#" class="btn btn-primary" @click="applyNewPhone">修改电话</a>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">小区名称</label>
      <div class="col-sm-12">
        <input type="text" v-model="f_residential_area" maxlength="100" class="form-control"/>
        <a href="#" class="btn btn-primary" @click="applyNewArea">修改小区</a>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">用户详细住址</label>
      <div class="col-sm-12">
        <input type="text"  readonly="readonly" v-model="f_address" maxlength="200" class="form-control"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">房屋结构</label>
      <div class="col-sm-12">
        <radio-group :value.sync="f_room_style" type="success" buttons="false">
          <radio value="平房">平房</radio>
          <radio value="多层">多层</radio>
          <radio value="小高层">小高层</radio>
          <radio value="高层">高层</radio>
          <radio value="别墅">别墅</radio>
          <radio value="独院">独院</radio>
        </radio-group>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">供暖方式</label>
      <div class="col-sm-12">
        <radio-group :value.sync="f_heating_style" type="success" buttons="false">
          <radio value="热力公司集中供暖">热力公司集中供暖</radio>
          <radio value="小区集中供暖">小区集中供暖</radio>
          <radio value="客户自行供暖">客户自行供暖</radio>
          <radio value="其他供暖">其他供暖</radio>
        </radio-group>
      </div>
    </div>
    <div class="form-group" v-show="f_heating_style == '其他供暖'">
      <label class="col-sm-12 control-label">其他供暖方式</label>
      <div class="col-sm-12">
        <input type="text" v-model="f_heating_style_" maxlength="30" class="form-control"/>
      </div>
    </div>
    <div style="height:50px;"></div>
  </form>
</template> -->
<template>
  <form :class="style__">
    <div class="form-group">
      <label class="form-group">
        <img src="../../../static/optionright.png" width="25" height="25"></img>&nbsp;
        用户姓名</label>
      <div class="form-group">
        <input type="text"  readonly="readonly"  v-model="f_user_name" maxlength="10" class="form-control"/>
      </div>
    </div>
    <div class="form-group">
      <label class="form-group">
        <img src="../../../static/optionright.png" width="25" height="25"></img>&nbsp;
        用户电话</label>
      <div class="form-group">
        <input type="text" v-model="f_user_phone" maxlength="15" class="form-group"/>
        <a href="#" class="btn btn-primary" @click="applyNewPhone">修改电话</a>
      </div>
    </div>
    <div class="form-group">
      <label class="form-group">
        <img src="../../../static/optionright.png" width="25" height="25"></img>&nbsp;
        小区名称</label>
      <div class="form-group">
        <input type="text" v-model="f_residential_area" maxlength="100" class="form-group"/>
        <a href="#" class="btn btn-primary" @click="applyNewArea">修改小区</a>
      </div>
    </div>
    <div class="form-group">
      <label class="form-group">
        <img src="../../../static/optionright.png" width="25" height="25"></img>&nbsp;
        用户详细住址</label>

      <div class="col-sm-12">
        <input type="text"  readonly="readonly" v-model="f_address" maxlength="200" class="form-group"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">
        <img src="../../../static/optionright.png" width="25" height="25"></img>&nbsp;
        房屋结构</label>
      <div class="col-sm-12">
        <radio-group :value.sync="f_room_style" type="success" buttons="false">
          <radio value="平房">平房</radio>
          <radio value="多层">多层</radio>
          <radio value="小高层">小高层</radio>
          <radio value="高层">高层</radio>
          <radio value="别墅">别墅</radio>
          <radio value="独院">独院</radio>
        </radio-group>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">
        <img src="../../../static/optionright.png" width="25" height="25"></img>&nbsp;
        供暖方式</label>
      <div class="col-sm-12">
        <radio-group :value.sync="f_heating_style" type="success" buttons="false">
          <radio value="热力公司集中供暖">热力公司集中供暖</radio>
          <radio value="小区集中供暖">小区集中供暖</radio>
          <radio value="客户自行供暖">客户自行供暖</radio>
          <radio value="其他供暖">其他供暖</radio>
        </radio-group>
      </div>
    </div>
    <div class="form-group" v-show="f_heating_style == '其他供暖'">
      <label class="col-sm-12 control-label">
        <img src="../../../static/optionright.png" width="25" height="25"></img>&nbsp;
        其他供暖方式</label>
      <div class="col-sm-12">
        <input type="text" v-model="f_heating_style_" maxlength="30" class="form-control"/>
      </div>
    </div>
    <div style="height:50px;"></div>
  </form>
</template>
<script>
import Vue from 'vue'
import RadioGroup from 'vue-strap/src/radioGroup'
import Radio from 'vue-strap/src/radioBtn'

export default {
  title: '用户基本信息',
  data() {
    return this.$parent.$parent.data
  },
  methods: {
    applyNewPhone() {
      let self = this
      let criteria = 'f_user_phone=\'' + this.f_user_phone + '\''
      this.$post(Vue.url + 'logic/现场修改电话',
      {data:{id: this.f_check_item_id, f_plan_id:this.f_check_plan_id, f_condition: criteria}},
      {resolveMsg: null, rejectMsg: null}).then(
          (response) => {
            HostApp.updateUserPhone(self.f_check_item_id, criteria)
            HostApp.alert('修改电话成功')
          }
        ).catch(
          (response) => {
            HostApp.alert('修改电话失败')
          }
        )
    },
    applyNewArea() {
      let self = this
      let criteria = 'f_residential_area=\'' + this.f_residential_area + '\''
      this.$post(Vue.url + 'logic/现场修改电话',
      {data:{id: this.f_check_item_id, f_plan_id:this.f_check_plan_id, f_condition: criteria}},
      {resolveMsg: null, rejectMsg: null}).then(
          (response) => {
            HostApp.updateUserPhone(self.f_check_item_id, criteria)
            HostApp.alert('修改小区成功')
          }
        ).catch(
          (response) => {
            HostApp.alert('修改小区失败')
          }
        )
    }
  },
  ready() {
    this.$watch('f_heating_style', function (val) {
      if(val != '其他供暖') {
        this.f_heating_style_ = null
      }
    })
  }
}
</script>
